﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace SistemadeEstágios
{
    
    public partial class frmPrincipal : Form
    {
        public const int WM_NCLBUTTONDOWN = 0xA1;
        public const int HT_CAPTION = 0x2;

        [DllImportAttribute("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd,
                         int Msg, int wParam, int lParam);
        [DllImportAttribute("user32.dll")]
        public static extern bool ReleaseCapture();

        public frmPrincipal()
        {
            InitializeComponent();
        }

        private void mnuSair_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Deseja realmente sair do Sistema?", LblTitulo.Text, MessageBoxButtons.YesNo) == DialogResult.Yes)
                Application.Exit();
        }

        private void mnuCadEstagiarios_Click(object sender, EventArgs e)
        {
            frmCadEstagiarios frm = new frmCadEstagiarios();
            frm.MdiParent = this;
            frm.Show();
        }

        private void mnuSobre_Click(object sender, EventArgs e)
        {
            About a = new About();
            a.ShowDialog();
        }

        private void mnuCadCoordenadores_Click(object sender, EventArgs e)
        {
            frmCadCoordenadores frm = new frmCadCoordenadores();
            frm.MdiParent = this;
            frm.Show();
        }

        private void mnuCadEmpresas_Click(object sender, EventArgs e)
        {
            frmCadEmpresas frm = new frmCadEmpresas();
            frm.MdiParent = this;
            frm.Show();
        }

        private void mnuCadResponsaveis_Click(object sender, EventArgs e)
        {
            frmCadResponsavel frm = new frmCadResponsavel();
            frm.MdiParent = this;
            frm.Show();
        }

        private void mnuRelContratos_Click(object sender, EventArgs e)
        {
            frmViewContrato frm = new frmViewContrato();
            frm.MdiParent = this;
            frm.Show();
        }

        private void mnuRelEstagios_Click(object sender, EventArgs e)
        {
            frmFiltroRelEstagiarios frm = new frmFiltroRelEstagiarios();
            frm.MdiParent = this;
            frm.Show();
        }

        private void LblFechar_Click(object sender, EventArgs e)
        {
            mnuSair_Click(LblFechar, e);
        }

        private void LblTitulo_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                ReleaseCapture();
                SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            }

        }

        private void LbMinimiza_Click(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Minimized;
        }

        private void LblFechar_MouseHover(object sender, EventArgs e)
        {
            LblFechar.BackColor = Color.Red;
        }

        private void LblFechar_MouseLeave(object sender, EventArgs e)
        {
            LblFechar.BackColor = SystemColors.HotTrack;
        }

        private void mnuCadContratos_Click(object sender, EventArgs e)
        {
            frmCadContratos frm = new frmCadContratos();
            frm.MdiParent = this;
            frm.Show();
        }

        private void testeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmCadCoordenadores frm = new frmCadCoordenadores();
            frm.ShowDialog();
        }

    }
}
